﻿#include "AlignmentEditEntry.h"
#include "BooleanEditEntry.h"

struct AlignmentEditEntry::AlignmentEditEntryPrivate {
    QPointer<BooleanEditEntry> entryLeft;
    QPointer<BooleanEditEntry> entryLeading;
    QPointer<BooleanEditEntry> entryRight;
    QPointer<BooleanEditEntry> entryTrailing;
    QPointer<BooleanEditEntry> entryHCenter;
    QPointer<BooleanEditEntry> entryJustify;
    QPointer<BooleanEditEntry> entryAbsolute;
    QPointer<BooleanEditEntry> entryHorizontalMask;
    QPointer<BooleanEditEntry> entryTop;
    QPointer<BooleanEditEntry> entryBottom;
    QPointer<BooleanEditEntry> entryVCenter;
    QPointer<BooleanEditEntry> entryBaseLine;
    QPointer<BooleanEditEntry> entryVerticalMask;
    QPointer<BooleanEditEntry> entryCenter;
};

AlignmentEditEntry::~AlignmentEditEntry() { }

AlignmentEditEntry::AlignmentEditEntry(QWidget *parent) : EditEntry{parent} {
    p.reset(new AlignmentEditEntryPrivate);
    initUi();
    retranslateUi();
}

void AlignmentEditEntry::setValue(const Qt::Alignment &value) {
    p->entryLeft->setValue(value & Qt::AlignLeft);
}

Qt::Alignment AlignmentEditEntry::value() const {
    Qt::Alignment alignment;
    return alignment;
}

void AlignmentEditEntry::initUi() {
    p->entryLeft = new BooleanEditEntry;
    appendChildEntry(p->entryLeft);

    p->entryLeading = new BooleanEditEntry;
    appendChildEntry(p->entryLeading);

    p->entryRight = new BooleanEditEntry;
    appendChildEntry(p->entryRight);

    p->entryTrailing = new BooleanEditEntry;
    appendChildEntry(p->entryTrailing);

    p->entryHCenter = new BooleanEditEntry;
    appendChildEntry(p->entryHCenter);

    p->entryJustify = new BooleanEditEntry;
    appendChildEntry(p->entryJustify);

    p->entryAbsolute = new BooleanEditEntry;
    appendChildEntry(p->entryAbsolute);

    p->entryHorizontalMask = new BooleanEditEntry;
    appendChildEntry(p->entryHorizontalMask);

    p->entryTop = new BooleanEditEntry;
    appendChildEntry(p->entryTop);

    p->entryBottom = new BooleanEditEntry;
    appendChildEntry(p->entryBottom);

    p->entryVCenter = new BooleanEditEntry;
    appendChildEntry(p->entryVCenter);

    p->entryBaseLine = new BooleanEditEntry;
    appendChildEntry(p->entryBaseLine);

    p->entryVerticalMask = new BooleanEditEntry;
    appendChildEntry(p->entryVerticalMask);

    p->entryCenter = new BooleanEditEntry;
    appendChildEntry(p->entryCenter);
}

void AlignmentEditEntry::retranslateUi() {
    p->entryLeft->setTitle(tr("AlignLeft"));
    p->entryLeading->setTitle(tr("AlignLeading"));
    p->entryRight->setTitle(tr("AlignRight"));
    p->entryTrailing->setTitle(tr("AlignTrailing"));
    p->entryHCenter->setTitle(tr("AlignHCenter"));
    p->entryJustify->setTitle(tr("AlignJustify"));
    p->entryAbsolute->setTitle(tr("AlignAbsolute"));
    p->entryHorizontalMask->setTitle(tr("AlignHorizontal_Mask"));
    p->entryTop->setTitle(tr("AlignTop"));
    p->entryBottom->setTitle(tr("AlignBottom"));
    p->entryVCenter->setTitle(tr("AlignVCenter"));
    p->entryBaseLine->setTitle(tr("AlignBaseLine"));
    p->entryVerticalMask->setTitle(tr("AlignVertical_Mask"));
    p->entryCenter->setTitle(tr("AlignCenter"));
}
